package top.gytf.unifiedcall.support.producer.response;


import lombok.Data;
import lombok.experimental.FieldNameConstants;
import org.springframework.boot.context.properties.ConfigurationProperties;
import top.gytf.unifiedcall.support.producer.constant.UnifiedCallProducerConstants;

/**
 * Producer的response模块的配置
 */
@Data
@FieldNameConstants
@ConfigurationProperties(prefix = UnifiedCallProducerConstants.Response.PREFIX)
public class UnifiedCallProducerResponseProperties {
    /**
     * 是否启用
     */
    private boolean enable = true;

    /**
     * 响应异常处理配置
     */
    private ExceptionHandler exception = new ExceptionHandler();

    /**
     * 响应包装配置
     */
    private WrapHandler wrap = new WrapHandler();

    @Data
    @FieldNameConstants
    public static class ExceptionHandler {
        /**
         * 是否启用响应异常处理
         */
        private boolean enable = true;

        /**
         * 是否在未知异常时返回异常信息
         */
        private boolean hasMessageWhenUnknownException = false;

        /**
         * 是否在处理异常时打印异常信息
         */
        private boolean printHandledException = true;
    }


    @Data
    @FieldNameConstants
    public static class WrapHandler {
        /**
         * 是否启用响应包装
         */
        private boolean enable = true;
    }
}
